refactor: store words as objects (@miodec)#8161
Open
Miodec wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors test word storage from string[] (+ parallel section index list) to structured word objects (text, display, textWithCommit, sectionIndex) as a prep step for future work.
Changes:
- Introduce
Wordobject model intest-words+ migrate call sites fromgetText/getCurrentTexttoget/getCurrent - Update UI/rendering + caret/keymap targeting to use
display/text/textWithCommitas appropriate - Adjust event log + unit test mocking to reflect the new structure
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/ts/test/timer-progress.ts | Reads sectionIndex from word objects for custom-section progress. |
| frontend/src/ts/test/test-words.ts | Core refactor: words become objects; new get/getCurrent APIs. |
| frontend/src/ts/test/test-ui.ts | UI updated to use word.display / word.text instead of raw strings. |
| frontend/src/ts/test/test-timer.ts | Keymap “next” highlight uses getCurrent().text. |
| frontend/src/ts/test/test-logic.ts | Init/addWord updated for new word accessors/fields. |
| frontend/src/ts/test/replay-ui.ts | Replay targets now use word.text (no commit char). |
| frontend/src/ts/test/practise-words.ts | Practice word extraction updated to word.text. |
| frontend/src/ts/test/pace-caret.ts | Pace caret logic updated to measure word.display. |
| frontend/src/ts/test/funbox/funbox-functions.ts | Funbox logic updated to display/text/get(...). |
| frontend/src/ts/test/events/data.ts | Event log now serializes targetWords from textWithCommit. |
| frontend/src/ts/input/listeners/input.ts | Input correctness comparisons now use textWithCommit. |
| frontend/src/ts/input/helpers/word-navigation.ts | Navigation + script toggling now uses textWithCommit. |
| frontend/src/ts/input/handlers/insert-text.ts | Target word comparisons/length checks now use textWithCommit. |
| frontend/src/ts/input/handlers/delete.ts | Delete logic now uses textWithCommit. |
| frontend/src/ts/input/handlers/before-insert-text.ts | Pre-insert validation now uses textWithCommit. |
| frontend/src/ts/input/handlers/before-delete.ts | Confidence-mode checks now use previousWord?.textWithCommit. |
| frontend/src/ts/elements/caret.ts | Caret placement uses word.display for grapheme length. |
| frontend/src/ts/commandline/lists/result-screen.ts | Copy-words output now maps word objects to .text. |
| frontend/tests/test/events/stats.spec.ts | Updates test-words mock + helpers for new word object structure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mainly as an inbetween step for a future pr.